package com.ciaojian.core.model;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.ciaojian.core.enums.business.ChannelEnum;
import com.ciaojian.core.enums.business.OrderIsUserMemberEnum;
import com.ciaojian.core.enums.business.OrderOrderTypeEnum;
import com.ciaojian.core.enums.business.OrderStatusEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

/**
 * @author Atlakyn
 */
@Builder
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("d_order")
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class Order extends Model<Order> implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 发型师 id
     */
    private Integer workerId;

    @ApiModelProperty("用户id")
    private Integer userId;

    private Integer storeId;

    private String workerName;

    private String storeName;

    @ApiModelProperty("服务项目名称")
    private String type;

    private BigDecimal goodsTotal;

    private BigDecimal total;

    private String orderNo;

    private String rankNo;

    @ApiModelProperty("取号时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;

    private String payType;


    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    private BigDecimal payTotal;

    /**
     * 订单状态
     * 0  排队中
     * 1  服务中
     * 2  待付款
     * 21 已支付,待回调
     * 3  已支付
     * -1 已取消
     * 5  已完成
     * 6  已发货
     * 7  代发货
     */
    private OrderStatusEnum status;

//    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer couponId;

    @ApiModelProperty("产品组ID")
    private Integer productGroupId;

//    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String couponCode;

//    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal couponTotal;

    private String cancelResult;

    @ApiModelProperty("开始服务时间")
    private Date startServiceTime;

    @ApiModelProperty("结束服务时间")
    private Date endServiceTime;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date aboutRankTime;

    private Integer p1;

    private double p1Total;

    private Integer p2;

    private double p2Total;

    private Integer p3;

    private double p3Total;

    private Integer self;

    private double selfTotal;

    private String ticket;

    private String ticketType;

    private String ticketCode;

    private Integer sendStatus;

    private Integer overService;

    @ApiModelProperty("加盟商Id")
    private Integer franchiseesId;

    @ApiModelProperty("订单类型 1.普通 2.企业剪 3.春季次卡 4.抖音审核 5.膨胀券 6.会员 7.会员续费 9.美团 10.染发次卡 11权益订单 12哈啰订单")
    private OrderOrderTypeEnum orderType;

    private Integer sendPay;

    private String orderNoS;

    private String youzanCode;

    @TableField(exist = false)
    private Map<String, Integer> waitCensus;

    @TableField(exist = false)
    private double miter;

    /**
     * 顾客属性
     * 0 生客
     * 1 熟客
     * 2 深度客
     * 3 首次消费
     */
    private Integer customerType;


    @ApiModelProperty("邀请发型师")
    private Integer inviterId;

    private String serviceTime;

    /**
     * 取消原因
     */
    private String cancelReason;

    @ApiModelProperty("提前结束原因")
    private String earlyReason;

    @ApiModelProperty("是否是会员")
    private OrderIsUserMemberEnum isUserMember;

    @ApiModelProperty("报错描述")
    private String reportDetail;

    @ApiModelProperty("报错图片")
    private String reportImg;

    @ApiModelProperty("备注")
    private String remark;

    @ApiModelProperty("来源渠道 1.微信 2.抖音")
    private Integer channel;

    private Date updateTime;

}
